//
//  DLCreateRecordViewModel.m
//  AllPass
//
//  Created by apple on 2021/11/2.
//

#import "DLCreateRecordViewModel.h"
@interface DLCreateRecordViewModel()
@property(nonatomic,assign)CGFloat wid;
@property(nonatomic,retain)NSArray * titleArray;
@end
@implementation DLCreateRecordViewModel
- (instancetype)init
{
    self = [super init];
    if (self) {
        self.titleArray = @[NSLocalizedString(@"Title", nil),NSLocalizedString(@"User Name", nil),NSLocalizedString(@"Password", nil),NSLocalizedString(@"Repeat Password", nil),NSLocalizedString(@"Expiration Date", nil),NSLocalizedString(@"Web Site", nil)];
        [self calculateLabelWidth];
    }
    return self;
}
-(void)calculateLabelWidth{
    CGFloat wid = 0;
    for (NSString * name in self.titleArray) {
        CGFloat w = [name sizeWithFont:UIFontMake(14) maxSize:CGSizeMake(SCREEN_WIDTH, 20)].width;
        if (w > wid) {
            wid = w;
        }
    }
    self.wid = ceilf(wid);
}
- (NSArray *)titleArr{
    return self.titleArray;
}
- (CGFloat)cellLabWidth{    
    return self.wid;
}
@end
